import { wechatrequest } from './API/request'
import { getStorageSync } from '../crossplatform/apiservice/storage'

/**
 * 编辑企业信息
 * */
export const editCompanyMessage = ({
  addressArea,
  addressCity,
  addressProvince,
  addressDetail,
  addressSimple,
  companyAbout,
  companyFinance,
  companyInfo,
  companyPerson,
  simpleName,
  companyPicUrl
}) => {
  const userinfo = getStorageSync('userinfo') || {}
  const companyId = userinfo.companyId
  return wechatrequest.postform(`/orgCompany/updateCompanyHome`, {
    data: {
      addressArea,
      addressCity,
      addressProvince,
      addressDetail,
      addressSimple,
      companyAbout,
      companyFinance,
      companyInfo,
      companyPerson,
      simpleName,
      companyPicUrl,
      companyId
    }
  })
}

/**
 * 创建名企
 * */
export const applyCompanyMessage = ({ area, companyId, person, slogan }) => {
  const userinfo = getStorageSync('userinfo') || {}
  companyId = companyId || userinfo.companyId
  return wechatrequest.postform(`/famous/apply/company`, {
    data: {
      companyId,
      area,
      person,
      slogan
    }
  })
}
